using System;
using System.Collections.Generic;
using System.Text;

namespace Slf.Samples.ExtendingFormattableLoggerBase
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.ForegroundColor = ConsoleColor.Green;
      Console.Out.WriteLine("If your custom logger derives from FormattableLoggerBase rather than LoggerBase, you get formatting out of the box.");
      Console.Out.WriteLine("Like the previous samples, this sample contains a custom ConsoleLogger that logs messages in different colors, depending on the logged level.\n\n");
      Console.ResetColor();


      //create logger
      ColoredConsoleLogger logger = new ColoredConsoleLogger();
      //Our logger implements IFormattableLogger interface and provides a Formatter property:
      logger.Formatter = new XmlFormatter();

      LoggerService.SetLogger(logger);

      CreateLogEntries();
      Console.ReadLine();
    }


    private static void CreateLogEntries()
    {
      ILogger logger = LoggerService.GetLogger();

      logger.Debug("This is debug output.");
      logger.Info("This is an information.");
      logger.Warn("This is a warning.");
      logger.Error("This is an error.");
      logger.Fatal("This is a fatal error.");
    }
  }
}